package com.wind.plugin.openAction.panel;

import com.intellij.ui.components.JBPanel;
import com.intellij.ui.table.JBTable;
import com.wind.plugin.openAction.CustomTextEditorAi;
import com.wind.plugin.openAction.Listener.MyTableModelListener;
import com.wind.plugin.openAction.entity.Action;

import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.util.List;

public class TablePannel extends JBPanel {

    private final JBTable actionsTable;
    private final DefaultTableModel tableModel;
    private final List<Action> actions;

    public TablePannel(CustomTextEditorAi customTextEditorAi, List<Action> actions)
    {
        this.setLayout(new GridLayout(1,1));
        this.actions = actions;
        // 创建表格
        String[] columnNames = {"动作类", "是否发送", "配置类型", "编辑"};
        tableModel = new DefaultTableModel(columnNames, 0);
        actionsTable = new JBTable(tableModel);

        MyTableModelListener modelListener = new MyTableModelListener(customTextEditorAi);
        tableModel.addTableModelListener(modelListener);

    }



}
